package com.naver.geotools;

import java.io.IOException;

import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.simple.SimpleFeatureIterator;
import org.geotools.data.simple.SimpleFeatureSource;
import org.geotools.geometry.jts.ReferencedEnvelope;
import org.geotools.grid.Grids;
import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.geometry.BoundingBox;


public class VectorGridsTest {
	public static void main(String[] args) throws IOException {
		ReferencedEnvelope gridBounds = new ReferencedEnvelope(33, 39, 124, 132, DefaultGeographicCRS.WGS84);
		SimpleFeatureSource grid = Grids.createSquareGrid(gridBounds, 1.0);
		
		SimpleFeatureCollection collection = grid.getFeatures();
		SimpleFeatureIterator features = collection.features();
		
		while (features.hasNext()) {
			SimpleFeature feature = features.next();
			BoundingBox bounds = feature.getBounds();
			System.out.println(bounds.toString());
		}
	}
	
	
}
